<template>
  <base-modal
    class="form-attachment-view-dialog"
    :title="field.displayName"
    :show.sync="visible"
    width="640px"
  >
    <div class="form-view-row-content base-file__preview">
      <base-file-item
        v-for="(a, index) in value"
        :key="index"
        :file="a"
        :source="value"
        readonly
      />
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="visible = false">{{ $t('common.base.close') }}</el-button>
    </div>
  </base-modal>
</template>

<script>
export default {
  name: 'form-attachment-view-dialog',
  data() {
    return {
      visible: false,
      field: {},
      value: [],
    }
  },
  methods: {
    open(field = {}, value = []) {
      this.field = field;
      this.value = value;
      this.visible = true;
    }
  }
};
</script>

<style lang="scss" scoped>
.form-attachment-view-dialog {
  ::v-deep .base-modal-body {
    min-height: 200px;
    padding: 20px;
  }
}
</style>
